@extends('layouts.app')
@section('content')
<div class="layui-form" lay-filter="LAY-app-forum-list-form" id="LAY-app-forum-list-form"
     style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">分类</label>
        <div class="layui-input-inline">
            <select name="category_id" lay-verify="required">
                <option value="">请选择</option>
                @foreach ($categories as $category)
                    <option value="{{ $category->id }}" @if ($forum && $forum->category_id === $category->id) 'selected' @endif>{{ $category->name }}</option>
                @endforeach
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-inline">
            <input type="text" name="title" value="{{ old('title', $forum->title) }}" lay-verify="required"
                       placeholder="请输入..." autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">封面</label>
        <div class="layui-input-inline">
            <input type="text" name="thumb" placeholder="请选择..." autocomplete="off"
                   class="layui-input">
        </div>
        <button style="float: left;" type="button" class="layui-btn" layadmin-event="select_image">选择图片</button>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">内容</label>
        <div class="layui-input-inline">
            <!-- 加载编辑器的容器 -->
            <script id="container" name="content" type="text/plain" style="width: 800px;height: 300px;"></script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-inline">
            <input type="checkbox" lay-verify="required" lay-filter="status" name="status" lay-skin="switch"
                   lay-text="已发布|待修改">
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-app-forum-list-form-submit" id="LAY-app-forum-list-form-submit" value="确认">
    </div>
</div>
@endsection

@section('js')
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container');
</script>
<style>
    .layui-form-select dl {
        z-index: 100000000 !important
    }
</style>
@endsection
